# -*- coding: utf-8 -*-

class FileUtils(object):
    """docstring for FileUtils"""

    def __init__(self):
        # pass 这个神奇的东西,表示什么也不用做
        pass

    # 把文本读成一个 字符串数组
    def readLine(self, filepath):
        stringLists = [];
        t = open(filepath, 'r', encoding='utf-8')
        for line in t:
            stringLists.append(line.strip());
        return stringLists

    def writeLine(self, filepath, lists):
        f = open(filepath, "w", encoding="utf-8")
        count = 0
        for list in lists:
            f.write(list + '\n')
            if count % 10000 == 0: #1万行刷新一次
               f.flush()
        f.close()

fileUtils = FileUtils();
# stringLists = fileUtils.readLine('C:\\Users\\Administrator\\Desktop\\conf\\luceneindex\\shop.json');
# print(len(stringLists));


# codelist = fileUtils.readLine("D:\\Users\\yincy\\Desktop\\code.txt")
#
# print(len(codelist));
# # 现在的机场poiid
# code1list = fileUtils.readLine("D:\\Users\\yincy\\Desktop\\code1.txt")
# print(len(code1list));
#
# for code1 in code1list:
# 	if code1 not in codelist:
# 		print(code1)
# 	pass
